// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

namespace SnapObjects.Data
{
    /// <summary>
    ///     Represents an object used to build a SQL DELETE statement.
    ///     The SQL DELETE statements can be used to remove one or more rows from the database.
    /// </summary>
    public class SqlDeleteBuilder : SqlBuilderBase, ISqlDeleteBuilder
    {
        private readonly DeleteBuildStatement _statement;
        private readonly ISqlFromBuilder _from;

        /// <summary>
        ///     Initializes a new instance of the SqlDeleteBuilder class.
        /// </summary>
        /// <param name="name">(Optional) The name for this SqlDeleteBuilder object.</param>
        public SqlDeleteBuilder(string name = "") : this(name, new DeleteBuildStatement())
        {

        }

        private SqlDeleteBuilder(string name, DeleteBuildStatement statement) : base(name)
        {
            _statement = statement;

            _from = new SqlFromBuilder(
                this, _statement.From, _statement.Join, _statement.Where, null, null, null);
        }

        /// <summary>
        ///     Gets the SQL statement type of the current object.
        /// </summary>
        public override SqlStatementType SqlType => SqlStatementType.Delete;

        internal override SqlBuildStatement Statement => _statement;

        /// <summary>
        ///     Creates a SQL DELETE statement and specifies the name of the table or view from which the rows are to be removed.
        /// </summary>
        /// <param name="table">The name of the table or view from which the rows are to be removed.</param>
        /// <returns>Returns the current ISqlDeleteBuilder object.</returns>
        public ISqlDeleteBuilder Delete(string table)
        {
            return this.Delete(table, "");
        }

        /// <summary>
        ///     Creates a SQL DELETE statement and specifies the name and the schema of the table or view from which 
        ///     the rows are to be removed.
        /// </summary>
        /// <param name="table">The name of the table or view from which the rows are to be removed.</param>
        /// <param name="schema">The schema of the table or view from which the rows are to be removed.</param>
        /// <returns>Returns the current ISqlDeleteBuilder object.</returns>
        public ISqlDeleteBuilder Delete(string table, string schema)
        {
            _statement.Table.Add(new TableElement(schema, table, ""));

            return this;
        }

        #region From

        /// <summary>
        ///     Gets whether any table source has been added to the current object using the From or FromRaw method.
        /// </summary>
        public bool HasTable => _from.HasTable;

        /// <summary>
        ///     Adds a table or view (with the alias and the schema specified) to the FROM clause of the current object.
        /// </summary>
        /// <param name="table">The name of the table or view.</param>
        /// <returns>Returns the current ISqlFromBuilder object.</returns>
        public ISqlFromBuilder From(string table)
        {
            return _from.From(table);
        }

        /// <summary>
        ///     Adds a table or view (with the alias and the schema specified) to the FROM clause of the current object.
        /// </summary>
        /// <param name="table">The name of the table or view.</param>
        /// <param name="alias">The alias of the table or view.</param>
        /// <returns>Returns the current ISqlFromBuilder object.</returns>
        public ISqlFromBuilder From(string table, string alias)
        {
            return _from.From(table, alias);
        }

        /// <summary>
        ///     Adds a table or view (with the alias and the schema specified) to the FROM clause of the current object.
        /// </summary>
        /// <param name="table">The name of the table or view.</param>
        /// <param name="alias">The alias of the table or view.</param>
        /// <param name="schema">The schema of the table or view.</param>
        /// <returns>Returns the current ISqlFromBuilder object.</returns>
        public ISqlFromBuilder From(string table, string alias, string schema)
        {
            return _from.From(table, alias, schema);
        }

        /// <summary>
        ///     Adds a derived table (specified by another ISqlBuilder object and an alias) to the FROM clause of the current object.
        /// </summary>
        /// <param name="sqlBuilder">An ISqlBuilder object which represents a derived table.</param>
        /// <param name="alias">The alias of the derived table.</param>
        /// <returns>Returns the current ISqlFromBuilder object.</returns>
        public ISqlFromBuilder From(ISqlBuilder sqlBuilder, string alias)
        {
            return _from.From(sqlBuilder, alias);
        }

        /// <summary>
        ///     Adds a table source (table, view, or derived table), specified by a raw SQL, to the FROM clause 
        ///     of the current object, and specifies an alias for this table source.
        /// </summary>
        /// <param name="fromClause">
        ///     A string of raw SQL which is the table source (table, view, or derived table). 
        ///     Actually, you can write any raw SQL if the SQL statement is valid.
        /// </param>
        /// <returns>Returns the current ISqlFromBuilder object.</returns>
        public ISqlFromBuilder FromRaw(string fromClause)
        {
            return _from.FromRaw(fromClause);
        }

        /// <summary>
        ///     Gets the alias of a table source that has been added to the current object using the From or FromRaw method.
        /// </summary>
        /// <param name="tableName">The name of a table source that has been added to the current object.</param>
        /// <returns>
        ///     Returns the alias of the specified table source if the table source exists.
        ///     Returns null if the table source does not exist.
        /// </returns>
        public string GetTableAlias(string tableName)
        {
            return _from.GetTableAlias(tableName);
        }

        /// <summary>
        ///     Adds a table source (table, view, or derived table), specified by a raw SQL, to the FROM clause 
        ///     of the current object, and specifies an alias for this table source.
        /// </summary>
        /// <param name="fromClause">
        ///     A string of raw SQL which is the table source (table, view, or derived table). 
        ///     Actually, you can write any raw SQL if the SQL statement is valid.
        /// </param>
        /// <param name="builderAlias">he alias for the table source.</param>
        /// <returns>Returns the current ISqlFromBuilder object.</returns>
        public ISqlFromBuilder FromRaw(string fromClause, string builderAlias)
        {
            return _from.FromRaw(fromClause, builderAlias);
        }
        #endregion

        #region Join

        /// <summary>
        ///     Creates a table by joining the original table source with a new table source, without specifying the 
        ///     type of the JOIN operator. You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder Join(string table)
        {
            return _from.Join(table);
        }

        /// <summary>
        ///     Creates a table by joining the original table source with a new table source, without specifying the 
        ///     type of the JOIN operator. You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <param name="alias">The alias of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder Join(string table, string alias)
        {
            return _from.Join(table, alias);
        }

        /// <summary>
        ///     Creates a table by joining the original table source with a new table source, without specifying the 
        ///     type of the JOIN operator. You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <param name="alias">The alias of the new table source.</param>
        /// <param name="schema">The schema of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder Join(string table, string alias, string schema)
        {
            return _from.Join(table, alias, schema);
        }

        /// <summary>
        ///     Uses the INNER JOIN operator to join the original table source directly with a raw SQL. 
        ///     You need to specify an alias for the raw SQL.
        /// </summary>
        /// <param name="joinClause">A string of raw SQL after the JOIN keyword.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder JoinRaw(string joinClause)
        {
            return _from.JoinRaw(joinClause);
        }

        /// <summary>
        ///     Creates a table by joining the original table source with a new table source which is specified by a 
        ///     subquery generated by an ISqlBuilder object. You need to specify an alias for the new table source.
        /// </summary>
        /// <param name="sqlBuilder">An ISqlBuilder object which represents a subquery.</param>
        /// <param name="alias">The alias of the new table source specified by the sqlBuilder parameter.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder Join(ISqlBuilder sqlBuilder, string alias)
        {
            return _from.Join(sqlBuilder, alias);
        }

        /// <summary>
        ///     Uses the INNER JOIN operator to join the original table source and the new table source to create a joined table. 
        ///     You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder InnerJoin(string table)
        {
            return _from.InnerJoin(table);
        }

        /// <summary>
        ///     Uses the INNER JOIN operator to join the original table source and the new table source to create a joined table. 
        ///     You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <param name="alias">The alias of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder InnerJoin(string table, string alias)
        {
            return _from.InnerJoin(table, alias);
        }

        /// <summary>
        ///     Uses the INNER JOIN operator to join the original table source and the new table source to create a joined table. 
        ///     You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <param name="alias">The alias of the new table source.</param>
        /// <param name="schema">The schema of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder InnerJoin(string table, string alias, string schema)
        {
            return _from.InnerJoin(table, alias, schema);
        }

        /// <summary>
        ///     Uses the INNER JOIN operator to join the original table source directly with a raw SQL to create a joined table. 
        ///     You need to specify an alias for the raw SQL.
        /// </summary>
        /// <param name="joinClause">A string of raw SQL after the INNER JOIN keyword.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder InnerJoinRaw(string joinClause)
        {
            return _from.InnerJoinRaw(joinClause);
        }

        /// <summary>
        ///     Uses the INNER JOIN operator to join the original table source and the new table source (specified by a subquery
        ///     generated by an ISqlBuilder object) to create a joined table. You need to specify an alias for the new table source.
        /// </summary>
        /// <param name="sqlBuilder">An ISqlBuilder object which represents a subquery.</param>
        /// <param name="alias">The alias of the new table source specified by the sqlBuilder parameter.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder InnerJoin(ISqlBuilder sqlBuilder, string alias)
        {
            return _from.InnerJoin(sqlBuilder, alias);
        }

        /// <summary>
        ///     Uses the LEFT OUTER JOIN operator to join the original table source and the new table source to create a joined table. 
        ///     You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder LeftJoin(string table)
        {
            return _from.LeftJoin(table);
        }

        /// <summary>
        ///     Uses the LEFT OUTER JOIN operator to join the original table source and the new table source to create a joined table. 
        ///     You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <param name="alias">The alias of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder LeftJoin(string table, string alias)
        {
            return _from.LeftJoin(table, alias);
        }

        /// <summary>
        ///     Uses the LEFT OUTER JOIN operator to join the original table source and the new table source to create a joined table. 
        ///     You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <param name="alias">The alias of the new table source.</param>
        /// <param name="schema">The schema of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder LeftJoin(string table, string alias, string schema)
        {
            return _from.LeftJoin(table, alias, schema);
        }

        /// <summary>
        ///     Uses the LEFT OUTER JOIN operator to join the original table source directly with a raw SQL to create 
        ///     a joined table. You need to specify an alias for the raw SQL.
        /// </summary>
        /// <param name="joinClause">A string of raw SQL after the LEFT OUTER JOIN keyword.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object that can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder LeftJoinRaw(string joinClause)
        {
            return _from.LeftJoinRaw(joinClause);
        }

        /// <summary>
        ///     Uses the LEFT OUTER JOIN operator to join the original table source and the new table source 
        ///     (specified by a subquery generated by an ISqlBuilder object) to create a joined table. 
        ///     You need to specify an alias for the new table source.
        /// </summary>
        /// <param name="sqlBuilder">An ISqlBuilder object which represents a subquery.</param>
        /// <param name="alias">The alias of the new table source specified by the sqlBuilder parameter.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object that can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder LeftJoin(ISqlBuilder sqlBuilder, string alias)
        {
            return _from.LeftJoin(sqlBuilder, alias);
        }

        /// <summary>
        ///     Creates a table by joining the original table source with a new table source using the RIGHT OUTER JOIN operator. 
        ///     You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder RightJoin(string table)
        {
            return _from.RightJoin(table);
        }

        /// <summary>
        ///     Creates a table by joining the original table source with a new table source using the RIGHT OUTER JOIN operator. 
        ///     You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <param name="alias">The alias of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder RightJoin(string table, string alias)
        {
            return _from.RightJoin(table, alias);
        }

        /// <summary>
        ///     Creates a table by joining the original table source with a new table source using the RIGHT OUTER JOIN operator. 
        ///     You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <param name="alias">The alias of the new table source.</param>
        /// <param name="schema">The schema of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder RightJoin(string table, string alias, string schema)
        {
            return _from.RightJoin(table, alias, schema);
        }

        /// <summary>
        ///     Uses the RIGHT OUTER JOIN operator to join the original table source directly with a string of raw SQL to 
        ///     create a joined table. You need to specify an alias for the raw SQL.
        /// </summary>
        /// <param name="joinClause">A string of raw SQL following the RIGHT OUTER JOIN operator.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder RightJoinRaw(string joinClause)
        {
            return _from.RightJoinRaw(joinClause);
        }

        /// <summary>
        ///     Uses the RIGHT OUTER JOIN operator to join the original table source and the new table source 
        ///     (specified by a subquery generated by an ISqlBuilder object) to create a joined table. 
        ///     You need to specify an alias for the new table source.
        /// </summary>
        /// <param name="sqlBuilder">An ISqlBuilder object which represents a subquery.</param>
        /// <param name="alias">The alias of the new table source specified by the sqlBuilder parameter.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object that can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder RightJoin(ISqlBuilder sqlBuilder, string alias)
        {
            return _from.RightJoin(sqlBuilder, alias);
        }

        /// <summary>
        ///     Uses the FULL OUTER JOIN operator to join the original table source and the new table source to create a 
        ///     joined table. You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder FullJoin(string table)
        {
            return _from.FullJoin(table);
        }

        /// <summary>
        ///     Uses the FULL OUTER JOIN operator to join the original table source and the new table source to create a 
        ///     joined table. You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <param name="alias">The alias of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder FullJoin(string table, string alias)
        {
            return _from.FullJoin(table, alias);
        }

        /// <summary>
        ///     Uses the FULL OUTER JOIN operator to join the original table source and the new table source to create a 
        ///     joined table. You need to specify a schema and an alias for the new table source.
        /// </summary>
        /// <param name="table">The name of the new table source.</param>
        /// <param name="alias">The alias of the new table source.</param>
        /// <param name="schema">The schema of the new table source.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder FullJoin(string table, string alias, string schema)
        {
            return _from.FullJoin(table, alias, schema);
        }

        /// <summary>
        ///     Uses the FULL OUTER JOIN operator to join the original table source directly with a raw SQL to create a joined table. 
        ///     You need to specify an alias for the raw SQL.
        /// </summary>
        /// <param name="joinClause">A string of raw SQL after the FULL OUTER JOIN keyword.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder FullJoinRaw(string joinClause)
        {
            return _from.FullJoinRaw(joinClause);
        }

        /// <summary>
        ///     Uses the FULL OUTER JOIN operator to join the original table source and the new table source 
        ///     (specified by a subquery generated by an ISqlBuilder object) to create a joined table. 
        ///     You need to specify an alias for the new table source.
        /// </summary>
        /// <param name="sqlBuilder">An ISqlBuilder object which represents a subquery.</param>
        /// <param name="alias">The alias of the new table source specified by the sqlBuilder parameter.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder FullJoin(ISqlBuilder sqlBuilder, string alias)
        {
            return _from.FullJoin(sqlBuilder, alias);
        }

        /// <summary>
        ///     Gets the type of the JOIN operation for the specified table source.
        /// </summary>
        /// <param name="tableName">
        ///     The name of the table source.
        /// </param>
        /// <returns>
        ///     Returns the value of the SqlJoinType enumerated type of the JOIN operation if a JOIN operation was specified; 
        ///     otherwise, returns null.
        /// </returns>
        public SqlJoinType? GetJoinType(string tableName)
        {
            return _from.GetJoinType(tableName);
        }

        /// <summary>
        ///     Uses the INNER JOIN operator to join the original table source directly with a raw SQL. 
        ///     You need to specify an alias for the raw SQL.
        /// </summary>
        /// <param name="joinClause">A string of raw SQL after the JOIN keyword.</param>
        /// <param name="builderAlias">The alias for the raw SQL.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder JoinRaw(string joinClause, string builderAlias)
        {
            return _from.JoinRaw(joinClause, builderAlias);
        }

        /// <summary>
        ///     Uses the INNER JOIN operator to join the original table source directly with a raw SQL to create a joined table. 
        ///     You need to specify an alias for the raw SQL.
        /// </summary>
        /// <param name="joinClause">A string of raw SQL after the INNER JOIN keyword.</param>
        /// <param name="builderAlias">The alias for the raw SQL.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder InnerJoinRaw(string joinClause, string builderAlias)
        {
            return _from.InnerJoinRaw(joinClause, builderAlias);
        }

        /// <summary>
        ///     Uses the LEFT OUTER JOIN operator to join the original table source directly with a raw SQL to create 
        ///     a joined table. You need to specify an alias for the raw SQL.
        /// </summary>
        /// <param name="joinClause">A string of raw SQL after the LEFT OUTER JOIN keyword.</param>
        /// <param name="builderAlias">The alias for the raw SQL.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object that can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder LeftJoinRaw(string joinClause, string builderAlias)
        {
            return _from.LeftJoinRaw(joinClause, builderAlias);
        }

        /// <summary>
        ///     Uses the RIGHT OUTER JOIN operator to join the original table source directly with a string of raw SQL to 
        ///     create a joined table. You need to specify an alias for the raw SQL.
        /// </summary>
        /// <param name="joinClause">A string of raw SQL following the RIGHT OUTER JOIN operator.</param>
        /// <param name="builderAlias">The alias for the raw SQL.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder RightJoinRaw(string joinClause, string builderAlias)
        {
            return _from.RightJoinRaw(joinClause, builderAlias);
        }

        /// <summary>
        ///     Uses the FULL OUTER JOIN operator to join the original table source directly with a raw SQL to create a joined table. 
        ///     You need to specify an alias for the raw SQL.
        /// </summary>
        /// <param name="joinClause">A string of raw SQL after the FULL OUTER JOIN keyword.</param>
        /// <param name="builderAlias">The alias for the raw SQL.</param>
        /// <returns>
        ///     Returns an ISqlJoinOnBuilder object which can be used to create the condition on which the join is based.
        /// </returns>
        public ISqlJoinOnBuilder FullJoinRaw(string joinClause, string builderAlias)
        {
            return _from.FullJoinRaw(joinClause, builderAlias);
        }

        /// <summary>
        ///     Returns an ISqlJoinOnAndOr object which represents an object used to build the JOIN clause of a SQL statement.
        /// </summary>
        /// <returns>
        ///     Returns the ISqlJoinOnAndOr object which can be used to build the JOIN clause of a SQL statement 
        ///     (e.g., adding search conditions to the JOIN clause).
        /// </returns>
        public ISqlJoinOnAndOr AsJoin()
        {
            return _from.AsJoin();
        }
        #endregion

        #region Where
        /// <summary>
        ///     Determines whether any search condition has been added to the WHERE clause of the current 
        ///     object using a Where or WhereRaw method and so on.
        /// </summary>
        public bool HasWhere => _from.HasWhere;

        /// <summary>
        ///     Gets whether a joined table has been created.
        /// </summary>
        public bool HasJoin => _from.HasJoin;

        /// <summary>
        ///     Gets whether a joined table has been created and the condition on which the join is based has been specified.
        /// </summary>
        public bool HasOn => _from.HasOn;

        /// <summary>
        ///     Creates a WHERE clause, and adds a search condition to the WHERE clause. Specifies a SQL expression 
        ///     on the left of the operator and a SQL parameter on the right of the operator. The operator is '='.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="parameter">
        ///     An ISqlParameter object which represents a SQL parameter on the right of the operator.
        ///     It can be created by calling the SqlBuilder.Parameter method.
        /// </param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr Where(string left, ISqlParameter parameter)
        {
            return _from.Where(left, parameter);
        }

        /// <summary>
        ///     Creates a WHERE clause, and adds a search condition to the WHERE clause. Specifies a SQL expression 
        ///     on the left of the operator and a SQL parameter on the right of the operator.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="sqlOperator">
        ///     An enumeration value of SqlBinaryOperator, which is the operator to test the two expressions on the left and right.
        /// </param>
        /// <param name="parameter">
        ///     An ISqlParameter object which represents a SQL parameter on the right of the operator.
        ///     It can be created by calling the SqlBuilder.Parameter method.
        /// </param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr Where(string left, SqlBinaryOperator sqlOperator, ISqlParameter parameter)
        {
            return _from.Where(left, sqlOperator, parameter);
        }

        /// <summary>
        ///     Creates a WHERE clause, and adds a search condition to the WHERE clause. 
        ///     Specifies SQL expressions on both the left and right of the operator. The operator is '='.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="right">A SQL expression on the right of the operator.</param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr Where(string left, string right)
        {
            return _from.Where(left, right);
        }

        /// <summary>
        ///     Creates a WHERE clause, and adds a search condition to the WHERE clause. 
        ///     Specifies SQL expressions on both the left and right of the operator.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="sqlOperator">
        ///     An enumeration value of SqlBinaryOperator, which is the operator to test the two expressions on the left and right.
        /// </param>
        /// <param name="right">A SQL expression on the right of the operator.</param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr Where(string left, SqlBinaryOperator sqlOperator, string right)
        {
            return _from.Where(left, sqlOperator, right);
        }

        /// <summary>
        ///     Creates a WHERE clause, and adds a search condition to the WHERE clause. Specifies a SQL expression on the left 
        ///     of the operator and a SQL subquery on the right. The operator is '='.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="sqlBuilder">An ISqlBuilder object which represents a SQL subquery on the right of the operator.</param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr Where(string left, ISqlBuilder sqlBuilder)
        {
            return _from.Where(left, sqlBuilder);
        }

        /// <summary>
        ///     Creates a WHERE clause, and adds a search condition to the WHERE clause. Specifies a SQL expression on
        ///     the left of the operator and a SQL subquery on the right.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="sqlOperator">
        ///     An enumeration value of SqlBinaryOperator, which is the operator to test the two expressions on the left and right.
        /// </param>
        /// <param name="sqlBuilder">An ISqlBuilder object which represents a SQL subquery on the right of the operator.</param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr Where(string left, SqlBinaryOperator sqlOperator, ISqlBuilder sqlBuilder)
        {
            return _from.Where(left, sqlOperator, sqlBuilder);
        }

        /// <summary>
        ///     Creates a WHERE clause, and adds a search condition to the WHERE clause by an ISqlWhereCondition object.
        /// </summary>
        /// <param name="condition">
        ///     An ISqlWhereCondition which represents a search condition in the WHERE clause. 
        ///     This object can be created by using the SqlBuilder.Where method and so on.
        /// </param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr Where(ISqlWhereCondition condition)
        {
            return _from.Where(condition);
        }

        /// <summary>
        ///     Creates a WHERE clause, and adds a raw SQL to the WHERE clause.
        /// </summary>
        /// <param name="whereClause">A string of raw SQL to be added to the WHERE clause.</param>
        /// <param name="parameters">
        ///     (Optional) An array of ISqlParameter objects which defines the SQL parameters used in the raw SQL.
        /// </param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr WhereRaw(string whereClause, params ISqlParameter[] parameters)
        {
            return _from.WhereRaw(whereClause, parameters);
        }

        /// <summary>
        ///     Creates a WHERE clause, and adds a search condition to the WHERE clause. Specifies a SQL 
        ///     expression on the left of the operator and a specific value on the right of the operator. The operator is '='.
        /// </summary>
        /// <param name="left">An expression on the left of the operator.</param>
        /// <param name="value">A specific value on the right of the operator.</param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr WhereValue(string left, object value)
        {
            return _from.WhereValue(left, value);
        }

        /// <summary>
        ///     Creates a WHERE clause, and adds a search condition to the WHERE clause. Specifies a SQL expression on 
        ///     the left of the operator and a specific value on the right of the operator.
        /// </summary>
        /// <param name="left">An expression on the left of the operator.</param>
        /// <param name="sqlOperator">
        ///     An enumeration value of SqlBinaryOperator, which is the operator to test the expression on the left and the value on the right.
        /// </param>
        /// <param name="value">A specific value on the right of the operator.</param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr WhereValue(string left, SqlBinaryOperator sqlOperator, object value)
        {
            return _from.WhereValue(left, sqlOperator, value);
        }

        /// <summary>
        ///     Creates a WHERE clause, adds a search condition to the WHERE clause by an ISqlWhereCondition object, 
        ///     and specifies a name for the search condition.
        /// </summary>
        /// <param name="condition">
        ///     An ISqlWhereCondition which represents a search condition in the WHERE clause. 
        ///     This object can be created by using the SqlBuilder.Where method and so on.
        /// </param>
        /// <param name="whereName">
        ///     The name for the search condition. It can be used to remove a search condition from the WHERE clause.
        /// </param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr Where(ISqlWhereCondition condition, string whereName)
        {
            return _from.Where(condition, whereName);
        }

        /// <summary>
        ///     Creates a WHERE clause, adds a raw SQL to the WHERE clause, and specifies a name for the raw SQL.
        /// </summary>
        /// <param name="whereClause">A string of raw SQL to be added to the WHERE clause.</param>
        /// <param name="whereName">The name for the raw SQL. It can be used to remove the raw SQL from the WHERE clause.</param>
        /// <param name="parameters">
        ///     (Optional) An array of ISqlParameter objects which defines the SQL parameters used in the raw SQL.
        /// </param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr WhereRaw(string whereClause, string whereName, params ISqlParameter[] parameters)
        {
            return _from.WhereRaw(whereClause, whereName, parameters);
        }

        /// <summary>
        ///     Returns an ISqlWhereAndOr object which represents an object used to build the WHERE clause in a SQL statement.
        /// </summary>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to build the WHERE clause in a SQL statement (e.g., 
        ///     adding search conditions to the WHERE clause).
        /// </returns>
        public ISqlWhereAndOr AsWhere()
        {
            return _from.AsWhere();
        }

        /// <summary>
        ///     Creates a WHERE clause, and adds a search condition to the WHERE clause. 
        ///     Uses IS NULL operator to search for values that are null.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the IS NULL operator.</param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr WhereIsNull(string left)
        {
            return _from.WhereIsNull(left);
        }

        /// <summary>
        ///     Creates a WHERE clause, and adds a search condition to the WHERE clause. 
        ///     Uses IS NOT NULL operator to search for values that are not null.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the IS NOT NULL operator.</param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr WhereIsNotNull(string left)
        {
            return _from.WhereIsNotNull(left);
        }

        /// <summary>
        ///     Creates a WHERE clause, and adds a search condition to the WHERE clause. Uses EXISTS to test for the 
        ///     existence of the record returned from a subquery.
        /// </summary>
        /// <param name="sqlBuilder">
        ///     An ISqlBuilder object which represents a SQL subquery on the right of the EXISTS operator.
        /// </param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr WhereExists(ISqlBuilder sqlBuilder)
        {
            return _from.WhereExists(sqlBuilder);
        }

        /// <summary>
        ///     Creates a WHERE clause, and adds a search condition to the WHERE clause. Uses the NOT EXISTS 
        ///     operator to test if the record returned from a subquery does not exist.
        /// </summary>
        /// <param name="sqlBuilder">
        ///     An ISqlBuilder object which represents a SQL subquery on the right of the EXISTS operator.
        /// </param>
        /// <returns>
        ///     Returns the ISqlWhereAndOr object which can be used to add more search conditions to the current WHERE clause.
        /// </returns>
        public ISqlWhereAndOr WhereNotExists(ISqlBuilder sqlBuilder)
        {
            return _from.WhereNotExists(sqlBuilder);
        }
        #endregion

        /// <summary>
        ///     Removes all of the search conditions that have been added to the WHERE clause.
        /// </summary>
        /// <returns>
        ///     Returns true if the removal is successful, and returns false if there were no search conditions in the WHERE clause.
        /// </returns>
        public bool RemoveWhere()
        {
            return _from.RemoveWhere();
        }

        /// <summary>
        ///     Removes the search condition (specified by name) from the WHERE clause.
        /// </summary>
        /// <param name="whereName">The name for one or more search conditions in the WHERE clause.</param>
        /// <returns>
        ///     Returns true if the removal is successful, and returns false if the specified search
        ///     condition name does not exist in the WHERE clause.
        /// </returns>
        public bool RemoveWhere(string whereName)
        {
            return _from.RemoveWhere(whereName);
        }

        #region GroupBy
        /// <summary>
        ///     Creates a GROUP BY clause and adds an array of SQL expressions (each expression specifies
        ///     a column or a non-aggregate calculation on a column).
        /// </summary>
        /// <param name="groupExpressions">
        ///     An array of SQL expressions (each expression specifies a column or a non-aggregate calculation on a column).
        /// </param>
        /// <returns>
        ///     Returns the current ISqlGroupBuilder object.
        /// </returns>
        public ISqlGroupBuilder GroupBy(params string[] groupExpressions)
        {
            return _from.GroupBy(groupExpressions);
        }

        /// <summary>
        ///     Creates a GROUP BY clause, and adds a raw SQL string containing one or more column expressions (each expression
        ///     specifies a column or a non-aggregate calculation on a column).
        /// </summary>
        /// <param name="groupClause">
        ///     A raw SQL string containing one or more column expressions (each expression specifies a column or a 
        ///     non-aggregate calculation on a column).
        /// </param>
        /// <returns>
        ///     Returns the current ISqlGroupBuilder object.
        /// </returns>
        public ISqlGroupBuilder GroupBy(string groupClause)
        {
            return _from.GroupBy(groupClause);
        }

        /// <summary>
        ///     Returns an ISqlGroupBuilder object which represents an object used to build the GROUP BY clause in a SQL statement.
        /// </summary>
        /// <returns>
        ///     Returns the ISqlGroupBuilder object which represents an object used to build the GROUP BY clause in a SQL statement.
        /// </returns>
        public ISqlGroupBuilder AsGroupBy()
        {
            return _from.AsGroupBy();
        }
        #endregion

        #region Having
        /// <summary>
        ///     Creates a HAVING clause, and adds a search condition to the HAVING clause. You can specify 
        ///     a SQL expression on the left the operator and a specific value on the right of the operator. The operator is '='.
        /// </summary>
        /// <param name="left">An expression on the left of the operator.</param>
        /// <param name="value">
        ///     The specific value on the right of the operator.
        /// </param>
        /// <returns>
        ///     Returns the ISqlHavingAndOr object which can be used to add more search conditions to the current HAVING clause.
        /// </returns>
        public ISqlHavingAndOr HavingValue(string left, object value)
        {
            return _from.HavingValue(left, value);
        }

        /// <summary>
        ///     Creates a HAVING clause, and adds a search condition to the HAVING clause. You can specify the SQL 
        ///     expression on the left the operator and a specific value on the right of the operator.
        /// </summary>
        /// <param name="left">An expression on the left of the operator.</param>
        /// <param name="sqlOperator">
        ///     An enumeration value of SqlBinaryOperator which is the operator to test the expression on the left and the value on the right.
        /// </param>
        /// <param name="value">
        ///     The specific value on the right of the operator.
        /// </param>
        /// <returns>
        ///     Returns the ISqlHavingAndOr object which can be used to add more search conditions to the current HAVING clause.
        /// </returns>
        public ISqlHavingAndOr HavingValue(string left, SqlBinaryOperator sqlOperator, object value)
        {
            return _from.HavingValue(left, sqlOperator, value);
        }

        /// <summary>
        ///     Creates a HAVING clause, and adds a search condition to the HAVING clause. You can specify a SQL 
        ///     expression on the left of the operator and a SQL parameter on the right of the operator. The operator is '='.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="parameter">
        ///     An ISqlParameter object which represents a SQL parameter on the right of the operator. 
        ///     It can be created by calling the SqlBuilder.Parameter method.
        /// </param>
        /// <returns>
        ///     Returns the ISqlHavingAndOr object which can be used to add more search conditions to the current HAVING clause.
        /// </returns>
        public ISqlHavingAndOr Having(string left, ISqlParameter parameter)
        {
            return _from.Having(left, parameter);
        }

        /// <summary>
        ///     Creates a HAVING clause and adds a search condition to the HAVING clause. You can specify a SQL expression 
        ///     on the left of the operator and a SQL parameter on the right of the operator.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="sqlOperator">
        ///     An enumeration value of SqlBinaryOperator, which is the operator to test the two expressions on the left and right.
        /// </param>
        /// <param name="parameter">
        ///     An ISqlParameter object which represents a SQL parameter on the right of the operator. 
        ///     It can be created by calling the SqlBuilder.Parameter method.
        /// </param>
        /// <returns>
        ///     Returns the ISqlHavingAndOr object which can be used to add more search conditions to the current HAVING clause.
        /// </returns>
        public ISqlHavingAndOr Having(string left, SqlBinaryOperator sqlOperator, ISqlParameter parameter)
        {
            return _from.Having(left, sqlOperator, parameter);
        }

        /// <summary>
        ///     Creates a HAVING clause and adds a search condition to the HAVING clause. You can specify SQL expressions
        ///     on both the left and right of the operator. The operator is '='.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="right">A SQL expression on the right of the operator.</param>
        /// <returns>
        ///     Returns the ISqlHavingAndOr object which can be used to add more search conditions to the current HAVING clause.
        /// </returns>
        public ISqlHavingAndOr Having(string left, string right)
        {
            return _from.Having(left, right);
        }

        /// <summary>
        ///     Creates a HAVING clause and adds a search condition to the HAVING clause. You can specify SQL expressions 
        ///     on both the left and right of the operator.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="sqlOperator">
        ///     An enumeration value of SqlBinaryOperator, which is the operator to test the two expressions on the left and right.
        /// </param>
        /// <param name="right">A SQL expression on the right of the operator.</param>
        /// <returns>
        ///     Returns the ISqlHavingAndOr object which can be used to add more search conditions to the current HAVING clause.
        /// </returns>
        public ISqlHavingAndOr Having(string left, SqlBinaryOperator sqlOperator, string right)
        {
            return _from.Having(left, sqlOperator, right);
        }

        /// <summary>
        ///     Creates a HAVING clause and adds a search condition to the HAVING clause. You can specify a SQL expression on the 
        ///     left of the operator and a SQL subquery on the right side. The operator is '='.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="sqlBuilder">An ISqlBuilder object which represents a SQL subquery on the right of the operator.</param>
        /// <returns>
        ///     Returns the ISqlHavingAndOr object which can be used to add more search conditions to the current HAVING clause.
        /// </returns>
        public ISqlHavingAndOr Having(string left, ISqlBuilder sqlBuilder)
        {
            return _from.Having(left, sqlBuilder);
        }

        /// <summary>
        ///     Creates a HAVING clause and adds a search condition to the HAVING clause. You can specify a SQL expression on the 
        ///     left of the operator and a SQL subquery on the right side.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="sqlOperator">
        ///     An enumeration value of SqlBinaryOperator which is the operator to test the two expressions on the left and right.
        /// </param>
        /// <param name="sqlBuilder">An ISqlBuilder object which represents a SQL subquery on the right of the operator.</param>
        /// <returns></returns>
        public ISqlHavingAndOr Having(string left, SqlBinaryOperator sqlOperator, ISqlBuilder sqlBuilder)
        {
            return _from.Having(left, sqlOperator, sqlBuilder);
        }

        /// <summary>
        ///     Creates a HAVING clause, and adds a search condition to the HAVING clause by an ISqlHavingCondition object.
        /// </summary>
        /// <param name="condition">
        ///     An ISqlHavingCondition object which represents a search condition in the HAVING clause.
        ///     This object can be created by using the SqlBuilder.Having method and so on.
        /// </param>
        /// <returns>
        ///     Returns the ISqlHavingAndOr object which can be used to add more search conditions to the current HAVING clause.
        /// </returns>
        public ISqlHavingAndOr Having(ISqlHavingCondition condition)
        {
            return _from.Having(condition);
        }

        /// <summary>
        ///     Creates a HAVING clause and adds a raw SQL to the HAVING clause.
        /// </summary>
        /// <param name="havingClause">A string of raw SQL to be added to the HAVING clause.</param>
        /// <param name="parameters">
        ///     (Optional) An array of ISqlParameter objects which define the SQL parameters used in the raw SQL.
        /// </param>
        /// <returns>
        ///     Returns the ISqlHavingAndOr object which can be used to add more search conditions to the current HAVING clause.
        /// </returns>
        public ISqlHavingAndOr HavingRaw(string havingClause, params ISqlParameter[] parameters)
        {
            return _from.HavingRaw(havingClause, parameters);
        }

        /// <summary>
        ///     Creates a HAVING clause, and adds a search condition to the HAVING clause by an ISqlHavingCondition 
        ///     object and specifies the name for the search condition.
        /// </summary>
        /// <param name="condition">
        ///     An ISqlHavingCondition object which represents a search condition in the HAVING clause.
        ///     This object can be created by using the SqlBuilder.Having method and so on.
        /// </param>
        /// <param name="havingName">The name for the search condition.</param>
        /// <returns>
        ///     Returns the ISqlHavingAndOr object which can be used to add more search conditions to the current HAVING clause.
        /// </returns>
        public ISqlHavingAndOr Having(ISqlHavingCondition condition, string havingName)
        {
            return _from.Having(condition, havingName);
        }

        /// <summary>
        ///     Creates a HAVING clause, and adds a raw SQL to the HAVING clause and specifies a name for the raw SQL.
        /// </summary>
        /// <param name="havingClause">A string of raw SQL to be added to the HAVING clause.</param>
        /// <param name="havingName">The name for the raw SQL.</param>
        /// <param name="parameters">
        ///     (Optional) An array of ISqlParameter objects which define the SQL parameters used in the raw SQL.
        /// </param>
        /// <returns>
        ///     Returns the ISqlHavingAndOr object which can be used to add more search conditions to the current HAVING clause.
        /// </returns>
        public ISqlHavingAndOr HavingRaw(string havingClause, string havingName, params ISqlParameter[] parameters)
        {
            return _from.HavingRaw(havingClause, havingName, parameters);
        }

        /// <summary>
        ///     Returns an ISqlHavingAndOr object that can be used to add a search condition to a group or an aggregate in the HAVING clause.
        /// </summary>
        /// <returns>
        ///     Returns the ISqlHavingAndOr object that can add a search condition to a group or an aggregate in the HAVING clause.
        /// </returns>
        public ISqlHavingAndOr AsHaving()
        {
            return _from.AsHaving();
        }
        #endregion

        #region OrderBy
        /// <summary>
        ///     Creates an ORDER BY clause and specifies one or more sort criteria in ascending order.
        /// </summary>
        /// <param name="orderExpressions">
        ///     (Optional) An array of expressions which specify a column or an expression on which to sort the query result set.
        /// </param>
        /// <returns>
        ///     Returns an ISqlOrderThenBuilder object which can be used to add more sort criteria to the current ORDER BY clause.
        /// </returns>
        public ISqlOrderThenBuilder OrderByAscending(params string[] orderExpressions)
        {
            return _from.OrderByAscending(orderExpressions);
        }

        /// <summary>
        ///     Creates an ORDER BY clause and specifies one or more sort criteria in descending order.
        /// </summary>
        /// <param name="orderExpressions">
        ///     (Optional) An array of expressions which specify a column or an expression on which to sort the query result set.
        /// </param>
        /// <returns>
        ///     Returns an ISqlOrderThenBuilder object which can be used to add more sort criteria to the current ORDER BY clause.
        /// </returns>
        public ISqlOrderThenBuilder OrderByDescending(params string[] orderExpressions)
        {
            return _from.OrderByDescending(orderExpressions);
        }

        /// <summary>
        ///     Creates an ORDER BY clause and specifies one or more sort criteria using a raw SQL.
        /// </summary>
        /// <param name="orderClause">A string of raw SQL which specifies one or more sort criteria.</param>
        /// <returns>
        ///     Returns an ISqlOrderThenBuilder object which can be used to add more sort criteria to the current ORDER BY clause.
        /// </returns>
        public ISqlOrderThenBuilder OrderByRaw(string orderClause)
        {
            return _from.OrderByRaw(orderClause);
        }

        /// <summary>
        ///     Creates an ORDER BY clause; and specifies one or more sort criteria using a raw SQL and specifies an alias for the raw SQL.
        /// </summary>
        /// <param name="orderClause">A string of raw SQL which specifies one or more sort criteria.</param>
        /// <param name="alias">The alias for the raw SQL.</param>
        /// <returns>
        ///     Returns an ISqlOrderThenBuilder object which can be used to add more sort criteria to the current ORDER BY clause.
        /// </returns>
        public ISqlOrderThenBuilder OrderByRaw(string orderClause, string alias)
        {
            return _from.OrderByRaw(orderClause, alias);
        }

        /// <summary>
        ///     Returns an ISqlOrderThenBuilder object which can be used to add sorting criteria to the ORDER clause.
        /// </summary>
        /// <returns>
        ///     Returns an ISqlOrderThenBuilder object which can be used to add sorting criteria to the ORDER clause.
        /// </returns>
        public ISqlOrderThenBuilder AsOrderBy()
        {
            return _from.AsOrderBy();
        }
        #endregion

        public override ISqlBuilder Clone()
        {
            return new SqlDeleteBuilder(
                this.Name, (DeleteBuildStatement)_statement.Clone());
        }
    }
}
